<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>


  <div id="app">

    <button @click="count--"> - </button>

    <span>{{count}}</span>

    <button @click="count++"> + </button>

    <br>
    <br>

    <button @click="fn">distory</button>

  </div>

  <script src="./js/vue2.6.12.js"></script>
  <script src="./js/axios.js"></script>

  <script>

    var app = new Vue({
      el:'#app',
      data:{
        count:100
      },
      methods:{
        fn(){
          this.$destroy();
        }
      },
      // 钩子要打在最外层
      beforeCreate(){
        console.log('beforeCreate');
      },
      created(){
        console.log('created');
      },
      beforeMount(){
        console.log('beforeMount');
      },
      mounted(){
        console.log('mounted');
      },
      beforeUpdate(){
        console.log('beforeUpdate');
      },
      updated(){
        console.log('updated');
      },
      beforeDestroy(){
        console.log('beforeDestroy');
        console.log('vue以外资源占用,定时器,延时器...');
      },
      destroyed(){
        console.log('destroyed');
      }

    })

    

  </script>
</body>
</html>